
package com.example.unique.ui.slideshow

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData


class SlideshowViewModel(application: Application) : AndroidViewModel(application) {

    // 存储用户的主题模式设置
    val isDarkMode = MutableLiveData<Boolean>().apply { value = false }

    // 设置主题模式
    fun setDarkMode(isDark: Boolean) {
        isDarkMode.value = isDark
        if (isDark) {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
        } else {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
        }
    }

}
